The Movie Toolbox provides functions that allow you to capture and restore the edit state of a movie. An edit state contains information that completely defines a movie's content at the time you create the edit state. It is, in essence, a checkpoint in the edit session. You can manage a movie's edit states in order to implement an undo capability for editing movies. For example, you can capture a movie's edit state before performing an editing operation, such as a cut, and later restore the old state. You can have several movie edit states obtained at different times during an editing session, and restore to any one of them at any time. In this manner, you can provide a multilevel undo capability. This section describes the Movie Toolbox functions that work with edit states.
Note that a movie's edit state does not save everything about a movie. Most important, the edit state does not contain information about the movie's spatial characteristics. For example, the edit state does not store the current boundary rectangle or clipping region. Consequently, edit states are best suited to supporting undo operations involving movie content, including track creation and removal. You can use other Movie Toolbox functions to support undo operations for movie characteristics. See "Functions That Modify Movie Properties," to learn more about these functions.
You can use the NewMovieEditState function to capture a movie's edit state. Use the UseMovieEditState to restore the movie to its condition according to a previous edit state. Your application must dispose of an edit state by calling the DisposeMovieEditState function. You must dispose of a movie's edit states before you dispose of the movie.
You can create an edit state by calling the NewMovieEditState function. This function creates an edit state that contains all the information describing a movie's content, including the current selection, the movie's tracks, and the media data associated with those tracks.
You must dispose of a movie's edit states before you dispose of the movie itself. Use the DisposeMovieEditState function (described on DisposeMovieEditState ) to dispose of an edit state.
pascal MovieEditState NewMovieEditState (Movie theMovie);
The NewMovieEditState function returns a movie edit state identifier. You can use this identifier with other Movie Toolbox edit state functions, such as UseMovieEditState (described in the next section). If this function could not create the edit state, it sets this returned identifier to nil .
Your application can use the UseMovieEditState function to return a movie to its condition according to an edit state you created previously.
pascal OSErr UseMovieEditState (Movie theMovie,
MovieEditState toState);
The UseMovieEditState function uses the information stored in the edit state to update the movie's contents. This may change the contents of some of the movie's tracks, or it may even add tracks to the movie or remove tracks from the movie. Consequently, the movie's time and spatial characteristics, especially the duration, may change as a result of restoring the saved edit state. Your application creates an edit state by calling the NewMovieEditState function, which is described in the previous section.
The DisposeMovieEditState function disposes of an edit state. Your application must dispose of any edit states you create.
You must dispose of a movie's edit states before you dispose of the movie itself.
pascal OSErr DisposeMovieEditState (MovieEditState state);
You create an edit state by calling the NewMovieEditState function, which is discussed on NewMovieEditState .